<template>
  <div>
    <!-- 头部导航 -->
    <div class="header">
      <div class="left iconfont icon-shouye" @click="userinfoFun"></div>
      <div class="center">VMUSICJIN</div>
      <div
        class="right iconfont icon-sousuo"
        @click.prevent="$router.push('/search')"
      ></div>
    </div>

    <!-- 导航 -->
    <div class="navs">
      <router-link tag="div" to="/recommend" class="item">
        <span>推荐</span>
      </router-link>
      <router-link tag="div" to="/rank" class="item">
        <span>排行榜</span>
      </router-link>
      <router-link tag="div" to="/singer" class="item">
        <span>歌手</span>
      </router-link>
      <router-link tag="div" to="/videomv" class="item">
        <span>MV</span>
      </router-link>
    </div>
  </div>
</template>

<script>
import Bus from "../../api/Bus";
export default {
  data() {
    return {
      meassage: false,
    };
  },
  methods: {
    userinfoFun() {
      this.meassage =true
      Bus.$emit("userinfo",this.meassage,"子组件向兄弟组件传参");
    },
  },
};
</script>
<style lang="less">
.header {
  background-color: #d44439;
  color: #fff;
  display: flex;
  height: 39px;
  line-height: 39px;
  text-align: center;
  .left,
  .right {
    flex: 0 0 40px;
    font-size: 18px;
  }
  .left {
    font-size: 22px;
  }
  .center {
    flex: 1;
  }
}
.navs {
  height: 40px;
  line-height: 40px;
  background-color: #d44439;
  display: flex;
  color: #fff;
  .item {
    flex: 1;
    text-align: center;
    font-size: 14px;
    span {
      display: inline-block;
      height: 21px;
      line-height: 21px;
      border-bottom: 2px solid transparent;
    }
    &.router-link-active span {
      border-color: #fff;
      font-weight: bold;
    }
  }
}
</style>